﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SQLite.Extensions
{
    public static class SQLiteExtensions
    {
        public static int ConditionalInsert<T>(this SQLite.SQLiteConnection db, T obj, Func<bool> condition) where T : new()
        {
            int res = -1;

            if (condition.Invoke())
                res = db.Insert(obj);

            return res;
        }
    }
}
